package com.own.component.message.util;

import com.own.component.message.model.BaseMessageModel;
import com.own.component.message.service.BaseSmsService;
import com.own.component.message.service.impl.MobileSmsServiceImpl;
import com.own.component.message.service.impl.UnicomSmsServiceImpl;

/**
 * SmsUtil
 *
 * @author chenxueli
 * @date 2022-08-15 11:53:00
 */
public class SmsUtil {

    public static BaseSmsService MOBILE = new MobileSmsServiceImpl();
    public static BaseSmsService UNICOM = new UnicomSmsServiceImpl();

    public static BaseSmsService DEFAULT_SERVICE = MOBILE;

    /**
     * 发送短信信息
     *
     * @param receiver 接收者
     * @param content  发送的内容
     */
    public static void send(String receiver, String content) {
        send(DEFAULT_SERVICE, receiver, content);
    }

    /**
     * 发送短信信息
     *
     * @param service  短信发送的服务
     * @param receiver 接收者
     * @param content  发送的内容
     */
    public static void send(BaseSmsService service, String receiver, String content) {
        var model = new BaseMessageModel<String>();
        model.setReceiver(receiver);
        model.setReceiver(content);
        service.send(model);
    }

}
